/**
 * @ author: 汪孟苹
 */
define(["jquery","oms_config/root"],function($,$root){
	var error = {};

	/* ajax请求出错时的统一处理 替换的形式 */
	error.init = function(obj,status,msg,callback) {
        switch (status) {
            case 0:
                callback(obj,status,"网络连接异常，请检查您的网络！");
                break;
            case 302:
                var config = $root.init();
                window.location.href = config.route.login;
                break;
            case 404:
                callback(obj,status,"您请求的服务不存在！");
                break;
            case 500:
                callback(obj,status,msg);
                break;
            default:
                break;
        }
    };

	return error;
});